	.text
	.align	2
start:
	MOV r0, #array
	LDW r1, [r0]
	MOV r2, #0
	MOV r3, #0
	MOV r7, #1
	MOV r7, r7 << #31
LOOP:
	ADD r4, r2, #1
	LDW r4, [r0+], r4 << #2
	MOV r5, #0
LOOP1:
	AND r6, r4, r7
	CMPSUB.A r6, #0
	BEQ SKIP
	ADD r3, r3, #1
SKIP:
	MOV r4, r4 << #1
	ADD r5, r5, #1
	CMPSUB.A r5, #32
	BSL LOOP1
	ADD r2, r2, #1
	CMPSUB.A r2, r1
	BSL LOOP
	STW r3, [r0]
	HLT
array:
	.long 4
	.long 0xdeadbeef
	.long 0xdeadbeef
	.long 0xdeadbeef
	.long 0xdeadbeef
